<template>
  <el-tabs v-model="active">
    <slot name="header"></slot>
    <el-tab-pane label="项目信息" name="first">
      <info-view :related-data="relatedData"></info-view>
    </el-tab-pane>
    <!-- <el-tab-pane label="立项详情">
        <approve-edit :query-id="queryId" view-mode v-if="hasItem"></approve-edit>
        <div v-else-if="+relatedData.item_status === 2">
          <confuse-view :related-data="relatedData"></confuse-view>
        </div>
        <div v-else class="empty-wrap">未立项</div>
      </el-tab-pane> -->
    <!-- <el-tab-pane label="立项附件">
        <attach-main :related-id="queryId" view-mode ref="attach"></attach-main>
      </el-tab-pane> -->
    <el-tab-pane label="担保意向函" name="letter">
      <letter-view :query-id="queryId" v-if="hasItem"></letter-view>
      <div v-else-if="+relatedData.item_status === 2">
        <confuse-view :related-data="relatedData"></confuse-view>
      </div>
      <div v-else class="empty-wrap">未立项</div>
    </el-tab-pane>
    <el-tab-pane label="放款通知书" name="notice">
      <div
        v-if="+relatedData.loan_approval_status === 0"
        class="p-5 text-center text-muted border rounded bg-light"
      >
        暂未发送放款通知书
      </div>
      <loan-notice :query-id="queryId" v-else></loan-notice>
    </el-tab-pane>
    <el-tab-pane label="项目附件" name="attach">
      <attach-view :query-id="queryId" :visible="visible"></attach-view>
    </el-tab-pane>
  </el-tabs>
</template>

<script>
// import ApproveEdit from '@/bigcredit/views/self/fast/item/components/ApproveEdit'
import LetterView from '@/credit/views/county/unionProvince/components/LetterView'
// import AttachMain from '@/bigcredit/views/self/fast/item/components/AttachMain'
import InfoView from '@/credit/views/city/bus/normal/Info'
import ConfuseView from '@/credit/views/city/bus/normal/item/ConfuseView'
import AttachView from '@/credit/components/AttachView'
import LoanNotice from '@/credit/views/county/unionProvince/components/LoanNotice'

export default {
  components: {
    // ApproveEdit,
    LetterView,
    // AttachMain,
    InfoView,
    ConfuseView,
    AttachView,
    LoanNotice,
  },
  props: {
    visible: Boolean,
    relatedData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      active: 'first',
    }
  },
  computed: {
    queryId() {
      return this.relatedData.customer_related_id || ''
    },
    hasItem() {
      return +this.relatedData.item_status === 1
    },
  },
  watch: {
    visible(val) {
      if (val) {
        this.$refs.attach && this.$refs.attach.getData()
      }
    },
  },
  created() {},
  mounted() {},
  methods: {},
}
</script>

<style lang="scss" scoped></style>
